package com.beiing.tianshuai.tianshuai.huodong.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.ActivitiesApplyForResultBean;
import com.beiing.tianshuai.tianshuai.huodong.model.ActivitiesApplyForModel;
import com.beiing.tianshuai.tianshuai.huodong.model.ActivitiesApplyForModelImpl;
import com.beiing.tianshuai.tianshuai.huodong.view.ActivitiesApplyForViewImpl;

/**
 * 提交商品信息的presenter层
 *
 * @author Jinda Yang
 * @date 2018/5/20
 */
public class ActivitiesApplyForPresenter extends BasePresenter
        implements ActivitiesApplyForPresenterImpl, ActivitiesApplyForModel.OnResponseListener {

    private ActivitiesApplyForViewImpl mView;

    private ActivitiesApplyForModelImpl mModel;

    public ActivitiesApplyForPresenter(ActivitiesApplyForViewImpl view) {
        mView = view;
        mModel = new ActivitiesApplyForModel(this);
    }

    @Override
    public void submitForFreeTicket(String uid, String aid, String amount, String tel, String username) {
        mView.showProgress();
        mModel.submitForFreeTicket(uid, aid, amount, tel, username);
    }

    @Override
    public void onSubmitFreeActivitySuccess(ActivitiesApplyForResultBean bean) {
        mView.hideProgress();
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onSubmitFreeActivityError(Throwable throwable) {
        mView.hideProgress();
        mView.onRequestFailed(throwable);
    }
}
